package com.study.samsung.Service.htService;

import com.study.samsung.Dao.htDao.AdminDao;
import com.study.samsung.Entity.htEntity.Admin;

public class AdminService {
    AdminDao dao = new AdminDao();

    public Integer selectByLogin(Admin admin){
        Admin a = dao.selectByLogin(admin.getAdminaccount());

        if (a==null){
            return -2;
        }else {
            if (a.getAdminpwd().equals(admin.getAdminpwd())){
                admin.setAdminid(a.getAdminid());
                admin.setAdminaccount(a.getAdminaccount());
                admin.setAdminpwd(a.getAdminpwd());
                admin.setAdminstate(a.getAdminstate());
                return 1;
            }else {
                return -1;
            }
        }
    }

    public Integer doUpdate(Admin a){
        return  dao.doUpdate(a);
    }
}
